package com.yu.newsSys.exceptionHandler;

import com.yu.newsSys.vo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public Result handleRuntimeException(RuntimeException ex) {
        System.out.println("未登录用户发起的异步请求将被处理");
        return Result.ERROR(302,"用户未登录");
    }
}
